#include<stdio.h>
int main()
{
	int x;
	int sum;
	scanf("%d",&x);
	/*for(;x;x=x/10)
	{
		sum+=x%10;
	}
	while(x>0)
	{
		sum+=x%10;
		x=x/10;
	}
	do{
		sum+=x%10;
		x=x/10;
	}while(x>0);*/
	while(1)
	{
		sum+=x%10;
		x=x/10;
		if(x<=0)
			break;
	}
	printf("%d",sum);
	return 0;
}
